package iss.anxios.service;

import iss.anxios.dao.MenuItemDao;
import iss.anxios.dto.MenuItem;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service("menuitemservice")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class MenuItemServiceImpl implements MenuItemService{

	@Autowired
	private MenuItemDao menuitemdao;
	
	@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	public void addMenuItem(MenuItem menuItem) {
		menuitemdao.SaveMenuItem(menuItem);
	}

	@Override
	public List<MenuItem> listMenuItems() {
		return menuitemdao.GetAllMenuItems();
	}

	@Override
	public void remove(MenuItem menuItem) {
		menuitemdao.remove(menuItem);
	}

	@Override
	public MenuItem GetMenuItemByID(int id) {
		return menuitemdao.GetMenuItemByID(id);
	}

}
